package com.beiing.tianshuai.tianshuai.widget;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.PopupWindow;

import com.beiing.tianshuai.tianshuai.R;
import com.beiing.tianshuai.tianshuai.entity.TicketSkuBean;

/**
 * Created by Jinda Yang on 2018/4/24.
 * Description : 活动详情中的报名弹窗 用于选择门票种类和数量
 */
public class TicketSkuPopupWindow extends PopupWindow {

    /**
     * 票务信息详情
     * 包含门票的库存、描述、价格、类别（与之对应的价格和库存数量）、缩略图
     */
    private TicketSkuBean mTicketSkuBean;

    /**
     * context
     */
    private Context mContext;

    public TicketSkuPopupWindow(Context context, TicketSkuBean ticketSkuBean) {
        super(context);

        mContext = context;
        mTicketSkuBean = ticketSkuBean;

        init();
    }

    private void init() {
        @SuppressLint("InflateParams") View view = LayoutInflater.from(mContext).inflate(R.layout.popwin_ticket_sku, null);
        //设置PopupWindow的View
        this.setContentView(view);
        //设置PopupWindow弹出窗体的宽
        this.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
        //设置PopupWindow弹出窗体的高
        this.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
        //设置PopupWindow弹出窗体可点击
        this.setFocusable(true);
        //设置PopupWindow弹出窗体动画效果
        this.setAnimationStyle(R.style.AnimBottom);
        //实例化一个ColorDrawable颜色为半透明
        ColorDrawable dw = new ColorDrawable(0xa6000000);
        //设置PopupWindow弹出窗体的背景
        this.setBackgroundDrawable(dw);
    }
}
